package com.lhd.creational.factory.simple;

/**
 * @Author: liuhd
 * @Date: 2024/10/20 11:10
 * @Description:
 */
public class SimpleFactory {
    public Coffee createCoffee(String name){
        if ("american".equals(name)){
            return new AmericanCoffee();
        }
        if ("latte".equals(name)){
            return new LatteCoffee();
        }
        throw new RuntimeException("没有此类咖啡");
    }
}
